import {bind} from "../../service/auth";
const utils = require('../../utils/util')

Page({
  // 绑定微信
  handleBind(){
    const openid =  wx.getStorageSync('openid')

    const data = {
        type:'bind',
        openid
      }

    bind(data).then(res=>{
      // 绑定成功之后，更新缓存的用户信息
          const userInfo = wx.getStorageSync('userinfo')
          wx.setStorageSync('userinfo',{...userInfo,openid})
        // 提示消息
        wx.showToast({
              title:'绑定成功',
              icon:'success',
              duration:1500
          })

        //跳转到来源页
        utils.loginRedirectTo()
    })
  },

    //暂时跳过，等以后再说
       skip(){
        utils.loginRedirectTo()
       }

})